import 'package:flutter/material.dart';
import 'package:flutter_app/generated/l10n.dart';
class WalletPage extends StatefulWidget {
  @override
  _WalletPageState createState() => _WalletPageState();
}
class ListItem {
  String name;
  ListItem({this.name});
}

List<ListItem> LIST_ITEMS = [
  ListItem(
    name: "BTC",
),
  ListItem(
    name: 'USDT',
),
  ListItem(
    name: 'USDC',
),
  ListItem(
    name: 'ETH',
),
  ListItem(
    name: 'BCH',
),
];
List<Widget> getCoinItems(context){
  return LIST_ITEMS.map((item) {
    return GestureDetector(
      onTap: (){Navigator.pushNamed(context, '/wallet/detail');},
      child: Row(
        children: [
          Image.asset(
            "assets/images/ic_btc.png",
            width: 36,
            height: 36,
          ),
          SizedBox(
            width: 15,
          ),
          Expanded(
            child: Container(
              padding: const EdgeInsets.fromLTRB(0.0,15.0,15.0,15.0),
              decoration: BoxDecoration(
                  border:Border(bottom:BorderSide(width: 1,color: Colors.grey[200]) )
              ),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(item.name,style: TextStyle(fontWeight: FontWeight.w600,fontSize: 17),),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.end,
                    children: [
                      Text('0.0000',style:TextStyle(fontFamily:'Helvetica',fontWeight: FontWeight.w600,fontSize: 18) ,),
                      Text('≈ \$0.00',style: TextStyle(fontFamily:'dinpro',color: Colors.grey),)
                    ],
                  )
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }).toList();
}
class _WalletPageState extends State<WalletPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: PreferredSize(//appbar高度
        preferredSize: Size.fromHeight(0.0),
        child: AppBar(
          brightness: Brightness.light,
          backgroundColor: Colors.transparent,
          elevation: 0,
        ),
      ),
      body: Padding(
        padding: const EdgeInsets.fromLTRB(15.0,0,0,0),
        child: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              SizedBox(
                height: 15,
              ),
              //钱包 title
              Text(S.of(context).wallet, style: TextStyle(fontSize: 20),),
              SizedBox(
                height: 20,
              ),
              //总资产折合
              Container(
                margin: EdgeInsets.fromLTRB(0, 10, 20, 30),
                padding: EdgeInsets.all(15.0),
                decoration: BoxDecoration(
                  color: Colors.blueAccent[700],
                  borderRadius: BorderRadius.circular(6),
                  image: DecorationImage(
                      image: AssetImage("assets/images/bg_wallet_statistics.png"),
                      fit: BoxFit.fitWidth
                  ),
                ),
                child: Row(
                  children: [
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            //账户总资产折合
                            Text(S.of(context).total_wallet,style: TextStyle(color: Colors.white54,fontSize: 16),),
                            SizedBox(
                              height: 10,
                            ),
                            Row(
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Text('\$',style: TextStyle(fontSize: 24,color: Colors.white)),
                                Text('0.00',style: TextStyle(fontSize: 26,fontWeight: FontWeight.w700,color: Colors.white),),
                              ],
                            )
                          ],
                        ),
                        SizedBox(
                          height: 50,
                        ),
                        Text('≈ 0 BTC',style: TextStyle(fontSize: 19,fontWeight: FontWeight.w500,color: Colors.white),)
                      ],
                    ),
                  ],
                ),
              ),
              Column(
                children: getCoinItems(context),
              )
            ],
          ),
        ),
      ),
    );
  }
}

